<template>
  <div class="login-container">
    <div class="login-box">
      <h2>签到系统</h2>
      <el-form :model="form" :rules="rules" ref="loginForm">
        <el-form-item prop="username">
          <el-input v-model="form.username" placeholder="用户名">
            <template #prefix>
              <el-icon><User /></el-icon>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item prop="password">
          <el-input v-model="form.password" type="password" placeholder="密码">
            <template #prefix>
              <el-icon><Lock /></el-icon>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleLogin" :loading="loading" block>登录</el-button>
        </el-form-item>
        <el-form-item>
          <el-button @click="handleRegister" block>注册</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script setup>
import { User, Lock } from '@element-plus/icons-vue'
import useLoginLogic from './login'
import './login.css'

const {
  loginForm,
  loading,
  form,
  rules,
  handleLogin,
  handleRegister
} = useLoginLogic()
</script> 